# _*_ encoding:utf-8 _*_

from app import creat_app
from flask import jsonify

# 1.创建app对象
# 参数：【dev pro test】
app = creat_app("dev")


# 2.定义跟路由，绑定视图函数
@app.route('/')
def index():
    # 需求：返回所有类视图的路由信息json字符串
    # app.url_map.iter_rules() ==>返回可迭代对象
    # 构建路由字典：{"路由路径": "视图函数名称"}
    # 字典推导式
    rule_dict = {rule.rule: rule.endpoint for rule in app.url_map.iter_rules()}
    return jsonify(rule_dict)

#
# if __name__ == '__main__':
#     app.run(debug=True, host='0.0.0.0', port='8001')
